import QtQuick 2.2
import QtQuick.Window 2.1

Window {
    visible: true
    width: 360
    height: 360

    Rectangle {
        anchors {
            fill: parent;
        }
        color: "green";

        Rectangle {
            id: rec1;
            width: 40;
            height: 40;
            color: "pink";
            anchors.left: parent.left;
            anchors.leftMargin: 10;
            anchors.top: parent.top;
            anchors.topMargin: 10;
        }

        Rectangle {
            id: rec2;
            width: rec1.width;
            height: rec1.height;
            color: "blue";
            anchors.top: rec1.top;
            anchors.left: rec1.right;
            anchors.leftMargin: 10;
        }

        Rectangle {
            id: rec3;
            width: rec2.width;
            height: rec2.height;
            color: "cadetblue";
            anchors.top: rec2.top;
            anchors.left: rec2.right;
            anchors.leftMargin: 10;
        }

        //anchors.centerIn
        Rectangle {
            width: 100;
            height: 100;
            anchors {
                centerIn: parent;
            }
            color: "skyblue";
        }
    }
}
